<template>
  <div class="top-bar">
    <!-- 版心 -->
    <div class="wrap top-bar-wrap">
      <!-- 左侧标题欢迎 -->
      <div class="left">欢迎来到叩丁狼积分商城</div>
      <!-- 右侧导航 -->
      <ul class="right">
        <li>
          <img src="../assets/img/userImg.f8bbec5e.png" width="24px" alt="" />
          用户名：游客
        </li>
        <li>我的积分：--</li>
        <li>获取积分</li>
        <li>叩丁狼官网</li>
        <li class="login-btn" v-if="isLoginStatus">
          <img src="../assets/img/cart.png" alt="" />
          购物车
          <strong>10</strong>
        </li>
        <li class="login-btn" @click="changeIsShowLoginModel" v-else>登录</li>
      </ul>
    </div>
  </div>
</template>

<script>
import { mapMutations, mapState } from "vuex";
export default {
  methods: {
    ...mapMutations({
      changeIsShowLoginModel: "showModel/changeIsShowLoginModel",
    }),
  },
  computed: {
    ...mapState({
      isLoginStatus: (state) => state.loginStatus.isLoginStatus,
    }),
  },
};
</script>

<style lang="less" scoped>
.top-bar {
  height: 40px;
  background: #242b39;
  line-height: 40px;
  font-size: 14px;
  font-family: SourceHanSansSC;
  font-weight: 300;
  color: #fffefe;
  .top-bar-wrap {
    display: flex;
    justify-content: space-between;
    text-align: center;
    .right {
      li {
        float: left;
        margin: 0 20px;
        cursor: pointer;
        &.login-btn {
          background: #0a328e;
          width: 124px;
          strong {
            width: 22px;
            height: 22px;
            background-color: red;
            border-radius: 50%;
            display: inline-block;
            line-height: 22px;
          }
        }
        img {
          border-radius: 50%;
          vertical-align: middle;
        }
      }
    }
  }
}
</style>